package com.yuanfeng.action.front.order.service;
import com.yuanfeng.action.front.order.dao.OrderDaoImpl;
import com.yuanfeng.pojo.Orders;
import com.yuanfeng.action.front.order.dao.OrderDao;

import java.util.List;

/**
 * 订单业务逻辑模块
 */
public class OrderServiceImpl implements OrderService {
	/**
	 * 订单的dao对象依赖注入
	 */
	private OrderDao orderDaoImpl;

	public void setOrderDaoImpl(OrderDaoImpl orderDaoImpl) {
		this.orderDaoImpl = orderDaoImpl;
	}

	/**
	 * 保存一个订单
	 * @param order
	 */
	public void saveOrder(Orders order) {
		orderDaoImpl.saveOrder(order);
	}

	/**
	 * 查询所有订单
	 * @param userId
	 * @return
	 */
	public List<Orders> queryOrders(String userId) {
		return orderDaoImpl.queryOrders(userId);
	}

	/**
	 * 一张订单
	 * @param order
	 * @return
	 */
	public Orders oneOrder(Orders order) {
		return orderDaoImpl.oneOrder(order);
	}

	/**
	 * 取消订单
	 * @param order
	 */
	public void cancle(Orders order) {
		orderDaoImpl.cancle(order);
	}
}
